﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="WebEFDemo.Index" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="Scripts/jquery-1.7.2.js"></script>
    <script type="text/javascript">
        function delStudent(id) {
            if (confirm("你确定要删除吗？")) {
                $.post("/AJAX/ajaxdelete.ashx", { ID: id}, function(data) {
                    if (data.IsSuccess) {
                        alert(data.ErrorMessage);
                        location.reload();
                    }
                    else {
                        alert(data.ErrorMessage);
                    }
                }, "json");
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table style="width: 800px; margin: auto;">
                <tr>
                    <td>学生列表</td>
                </tr>
                <tr style="background-color: darkturquoise;">
                    <td>编号</td>
                    <td>姓名</td>
                    <td>年龄</td>
                    <td>手机</td>
                    <td>邮箱</td>
                    <td>班级</td>
                    <td style="width:100px;">操作</td>
                </tr>
                    <asp:Repeater ID="repert_EFDemo" runat="server" OnItemCommand="repert_EFDemo_ItemCommand">
                        <ItemTemplate>
                <tr>
                            <td><%# Eval("stuid")%></td>
                            <td><%# Eval("stuname")%></td>
                            <td><%# Eval("stuage")%></td>
                            <td><%# Eval("phone")%></td>
                            <td><%# Eval("email")%></td>
                            <td><%# Eval("classname")%></td>
                            <td>
                                <a href='Update.aspx?id=<%# Eval("stuid") %>'>修改</a>
                                <a href="javascript:;" onclick='delStudent(<%# Eval("stuid") %>)'>删除</a>
                                <asp:LinkButton ID="link_denete" runat="server" CommandName="del" CommandArgument='<%# Eval("stuid")%>' OnClientClick="return confirm('你确定要删除吗？')">删除</asp:LinkButton></td>
                    </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                <tr>
                    <td>
                        <asp:Button ID="bnt_add" runat="server" Width="100px" Height="30px" Text="添加" BackColor="#00CC00" OnClick="bnt_add_Click" /></td>
                </tr>
            </table>
            
        </div>
    </form>
</body>
</html>
